<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .v-enter,
        .v-leave-to {
            opacity: 0;
            transform: translateY(100px);
        }

        /* .v-enter-active, */
        .v-leave-active {
            transition: all 2s ease;
            position: absolute;
        }

        .v-enter-to,
        .v-leave {
            opacity: 1;
            transform: translateY(0);
        }

        .v-move {
            transition: all 2s ease;
        }
    </style>

</head>

<body>
    <div id='app'>
        <button @click="flag = !flag">切换</button>
        <!-- <transition appear>
            <h3 v-show="flag">这是一个普通动画</h3>
        </transition> -->

        <transition-group appear tag="ul">
            <li v-for="(item,index) in goodsList" :key="item.id" @click="delGoods(index)"> {{item.name}} </li>
        </transition-group>
    </div>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                flag: true,
                goodsList: [{
                        id: 1,
                        name: '张三'
                    },
                    {
                        id: 2,
                        name: '李四'
                    },
                    {
                        id: 3,
                        name: '王五'
                    },
                ]
            },

            methods: {
                delGoods(index) {
                    this.goodsList.splice(index, 1)
                }
            },
            created() {
                // 先写它做什么的，在写是什么
                // this.intervalId =setInterval()
                // clearInterval(this.intervalId)
            },
        })
    </script>
</body>

</html>